#ifndef __VECTOR
#define __VECTOR

/*
basic definition of a vector datatype and the associated functions
to calculate with it.

mathematical reference:
-----------------------
[1] book title, author(s), ISBN
*/

// INCLUDES -------------------------------------------------------------------------
#include "base_datatypes.h"	// datatypes: "fNumber", "bool"

// DATATYPES ------------------------------------------------------------------------

/* basic vector
   details: [1], p. xxx */
typedef struct
{
	union
	{
		fNumber c[4];				// used in loops...
		struct
		{
			fNumber x, y, z, w;		// for direct calls...
		};
	};
} vector;

void vectorPrintf(vector* v);								// printf() for vector

// FUNCTIONS ------------------------------------------------------------------------

void vectorClear(vector* v);                            	// v -> [0,0,0,1]
void vectorSet(vector* v, vector* a);						// v = a

// ----> basic properties
fNumber vectorMagnitude(vector* v);							// total displacement
void vectorNormalize(vector* v);							// v -> to range (-)[0,1]
void vectorInverse(vector* v);								// v -> -(v)

// ----> addition
void vectorAdd(vector* v, vector* a, vector* b);        	// v = a + b
void vectorAddSelf(vector* v, vector* a);            		// v += a

// ----> subtraction
void vectorSubtract(vector* v, vector* a, vector* b);   	// v = a - b
void vectorSubtractSelf(vector* v, vector* a);       		// v -= a

// ----> scalar multiplication
void vectorMultiply(vector* v, vector* a, fNumber k);   	// v = a * k
void vectorMultiplySelf(vector* v, fNumber k);       		// v *= k

// ----> scalar division
void vectorDivide(vector* v, vector* a, fNumber k);   		// v = a / k
void vectorDivideSelf(vector* v, fNumber k);       			// v /= k

// ----> (in)equality
bool vectorIsEqual(vector* a, vector* b);                 	// a == b
bool vectorIsInequal(vector* a, vector* b);               	// a != b

// ----> scalar product
fNumber vectorScalarProduct(vector* v, vector* a);			// scalar product of v, a

// ----> vector product
void vectorVectorProduct(vector* v, vector* a, vector* b);	// v = vector product of a,b

#endif // __VECTOR
